<template>
	<view class="lead-page-main-box" @tap="changes">
		<image class="bg-image" mode="widthFix" src="https://h5.sx2b2c.com/images/common/leadPage/bg.png"></image>
		<view class="lead-page-box">
			<image class="lead-icon" mode="heightFix" src="https://h5.sx2b2c.com/images/common/leadPage/lead-icon.png">
			</image>
			<image class="lead-btn" mode="widthFix" src="https://h5.sx2b2c.com/images/common/leadPage/lead-btn.png">
			</image>
		</view>

	</view>
</template>

<script setup>
	import {
		statistics,
		createoder,
		wxLogin,
		send,
		check,
		subOrder,
		getYys
	} from '../../api/index.js'
	export default {
		data() {
			return {
				url: '',
				mobile: "",
				p_code:"",
				urlx:'',//跳转的支付宝地址
				param:""

			};
		},
		methods: {
			changes() {


				let system = navigator.userAgent.toLowerCase();
				//判断打开环境
				if (/MicroMessenger/.test(window.navigator.userAgent)) {

				} else if (/AlipayClient/.test(window.navigator.userAgent)) {

				} else {

				window.location.href =
					'alipays://platformapi/startapp?saId=10000007&qrcode='+encodeURIComponent(this.urlx+'?mobile='+this.mobile+'&a='+this.a+"&code="+this.p_code+'&param='+this.param)
				}
			}
		},

		onLoad(option) {
			
	if (option.param) {
				this.param = option.param
			}
			if (option.mobile) {
				this.mobile = option.mobile
			}
			if (option.a) {
				this.a = option.a
			}
			if(option.code){
			
				this.p_code = option.code
			
				if(this.p_code='2023102601'){
					this.urlx='http://41.syhy123.com/pzsh/#/pages/lead/lead'
				}else if(this.p_code='2023110801'){
					this.urlx='http://41.syhy123.com/tencent/#/pages/lead/lead'
				}
else if(this.p_code='2023110802'){
					this.urlx='http://41.syhy123.com/aiqiyi/#/pages/lead/lead'
				}
				
			}


			let system = navigator.userAgent.toLowerCase();
			//判断打开环境
			if (/MicroMessenger/.test(window.navigator.userAgent)) {
			} else if (/AlipayClient/.test(window.navigator.userAgent)) {
				getYys({
					mobile: this.mobile,
				}).then((resx) => {
					console.log(resx)
					subOrder({
						a: this.a,
						mobile: this.mobile,
						p_code:this.p_code, //产品码
						productType: '20', //产品类型
						type: '2', //1 是365,2是30
						province: resx.data.Province,
						order_city: resx.data.City,
						yys: resx.data.Isp,
						param:this.param
					}).then((result) => {
						this.url = result.data.orderStr
						this.url = result.data.orderStr
						let url = 'alipays://platformapi/startApp?appId=60000157&orderStr=' + result.data
							.orderStr;
						window.location.href = url

					})

				})
			} else {
		
				window.location.href =
					'alipays://platformapi/startapp?saId=10000007&qrcode='+encodeURIComponent(this.urlx+'?mobile='+this.mobile+'&a='+this.a+"&code="+this.p_code+'&param='+this.param)

			}

		}
	}
</script>

<style lang="scss" scoped>
	@keyframes butChange {
		0% {
			transform: scale(1);
		}

		50% {
			transform: scale(1.1);
		}

		100% {
			transform: scale(1);
		}
	}

	.lead-page-main-box {
		background-color: #fff;
		position: fixed;
		width: 100vw;
		min-height: 100vh;
		left: 0;
		top: 0;
		z-index: 9;
		display: flex;
		justify-content: center;
		align-items: center;

		.bg-image {
			display: block;
			width: 90%;
			margin-top: -300rpx;
		}

		.lead-page-box {
			position: absolute;
			left: 0;
			top: 0;
			width: 100%;
			min-height: 100vh;
			background: url('https://h5.sx2b2c.com/images/common/leadPage/shadown.png');

			.lead-icon {
				width: auto;
				height: 500rpx;
				display: block;
				position: absolute;
				top: 30rpx;
				right: 30rpx;
			}

			.lead-btn {
				position: absolute;
				width: 80%;
				height: auto;
				display: block;
				left: 10%;
				top: 78vw;
				animation: butChange 2s infinite;

			}

		}
	}
</style>